#include <iostream>
#include <cstdlib>
#include <limit.h>
using namespace std;

// need to be done in O(lgn) and space O(1)
// 
// my solution's O(n)
// so it comes with the time exceed problem.

double pow(double x, int n)
{
	if( n ==1 || (x-0)<0.0001 && (x-0)>-0.0001 || (x-1)<0.0001 && (x-1)>-0.0001)
		return x;
	if(n==0)
		return 1;
	int npow = n;
	bool bneg = false;
	if(n<0)
	{
		bneg = true;
		npow = -n;
	}

	double b_pow = 1, a_pow = x;
	double ret=1;
	for(int i=1;i<=npow;++i)
	{
		ret = b_pow * a_pow;
		b_pow = ret;
	}
	return (bneg) ? 1/ret : ret;
}


// we use a little trick here
// we represent n in its binary mode
// we take 4 bits as an example
// n=5 ----> 0101 ---> 2^2+2^0
// x^n=x^(2^2+2^1) = x^(2^2)*x^(2^0)
// x^5 = x^4 * x;

double npow(double x,int n)
{
	bool neg = n<0;
	double ret = 1.0;
	if(neg && n==INT_MIN)
	{
		n = -n;
	}
	n = (n^(n>>31)) - (n>>31); //abs(n)
	while(n)
	{
		if(n&1)
			ret *= x;
		x *= x;
		n >>= 1;
	}
	return ret;
}

int main()
{
	cout<<pow(-2.38000,-2)<<endl;
	return 0;
}